package com.lyh.utils;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * 功能
 * 作者：lyh
 * 日期：2024/8/8 10:25
 */
public class JDBCUtils {
    private static ComboPooledDataSource dataSource = null;

    static{
        dataSource = new ComboPooledDataSource();
    }

    //获取连接对象
    public static Connection getConnection() throws SQLException {
        return dataSource.getConnection();
    }

    //获取数据源对象
    public static DataSource getDataSource(){
        return dataSource;
    }
}
